//
//  TwoGeRenJiShi.m
//  EJLX
//
//  Created by adc on 15/11/23.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "TwoGeRenJiShi.h"

@implementation TwoGeRenJiShi
+(id)userWithDictionary:(NSDictionary*)userDic
{
    return [[self alloc]initWithDictionary:userDic];
}
-(id)initWithDictionary:(NSDictionary*)userDic
{
    self=[super init];
    if (self)
    {
        
        NSLog(@"111111%@",userDic);
       // _shopName=[userDic[@"shopName"]copy];
        
        
        if (![userDic[@"product"]isKindOfClass:[NSNull class]])
        {
            NSDictionary*product=userDic[@"product"];
            _name=[product[@"name"]copy];
            _discount=[product[@"discount"]copy];
            _ID=[product[@"id"]intValue];
            _price=[product[@"price"]intValue];
            _discountPrice=[product[@"discountPrice"]intValue];
            _commision=[product[@"commision"]intValue];
            if ([product[@"picture"]isKindOfClass:[NSNull class]])
            {
                _picture=@"";
            }
            else
            {
                _picture=[product[@"picture"]copy];
            }

            
        }
        
        if ([userDic[@"type"]isKindOfClass:[NSNull class]])
        {
            _type=0;
        }
        else
        {
             _type=[userDic[@"type"]intValue];
        }

        
        if ([userDic[@"shopId"]isKindOfClass:[NSNull class]])
        {
            _shopId=0;
        }
        else
        {
             _shopId=[userDic[@"shopId"]intValue];
        }


        if ([userDic[@"position"]isKindOfClass:[NSNull class]])
        {
            _position=0;
        }
        else
        {
           _position=[userDic[@"position"]intValue];
        }
        // _position=[userDic[@"position"]intValue];
         //_ID=[userDic[@"id"]intValue];
        if ([userDic[@"id"]isKindOfClass:[NSNull class]])
        {
            _ID=0;
        }
        else
        {
            _ID=[userDic[@"id"]intValue];
        }

        if ([userDic[@"shopId"]isKindOfClass:[NSNull class]])
        {
            _shopId=0;
        }
        else
        {
           _shopId=[userDic[@"shopId"]intValue];
        }

//        if (userDic[@"shopAvatar"])
//        {
//            _shopAvatar=@"";
//        }
//        else
//        {
//           _shopAvatar=[userDic[@"shopAvatar"]copy];
//        }

        
       
         //_shopId=[userDic[@"shopId"]intValue];
       // _shopAvatar=[userDic[@"shopAvatar"]copy];
        
        
        
        
    }
    return self;
}

@end
